﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace FlowDesigner.INotifyCommadBase
{
    public class NotifyBase: INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public event EventHandler CanExecuteChanged
        {
            add
            {
                CommandManager.RequerySuggested += value;
            }


            remove
            {
                CommandManager.RequerySuggested -= value;
            }
        }

        public void SetProperty<T>(ref T feild, T value, [CallerMemberName] string propName = "")
        {
            feild = value;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
        }
    }
}
